﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;


public partial class ReaderArrearage : System.Web.UI.Page
{
    public static string sqlpa = "";

    protected void Page_Load(object sender, EventArgs e)
    {
        sqlpa = "select readerid as 读者编号,ReaderName as 姓名,Password as 密码,Sex as 性别,ClassID as 班级,Telphone as 号码 ,Email as 邮箱,CreateDate as 创建日期,typename as 类型,Account as 账户余额,Remarks as 备注 from Reader_info ,Reader_type where Reader_info.ReaderType=Reader_Type.ReaderType and account<0";
        SqlDataSource1.SelectCommand = sqlpa;
    }
    protected void Cancel_Click(object sender, EventArgs e)
    {

        sqlpa = "select readerid as 读者编号,ReaderName as 姓名,Password as 密码,Sex as 性别,ClassID as 班级,Telphone as 号码 ,Email as 邮箱,CreateDate as 创建日期,typename as 类型,Account as 账户余额,Remarks as 备注 from Reader_info ,Reader_type where Reader_info.ReaderType=Reader_Type.ReaderType and account<0";
        SqlDataSource1.SelectCommand = sqlpa;



    }
    protected void baobiao_Click(object sender, EventArgs e)
    {

        SQL sql = new SQL();
        DataSet ds = sql.getDataset(sqlpa, "");
        DataTable dt = new DataTable();
        dt = ds.Tables[0];

        try
        {

            OutFileDao.OutFileToDisk(dt, "欠费读者查询结果", "F:\\数据库课设\\BookManage\\reports\\欠费读者.xls");
            Response.Write("<script language=javascript>alert('导出成功');window.location = 'LostBook.aspx';</script>");
        }
        catch (System.Exception ex)
        {
            Response.Write("<script language=javascript>alert('失败，文件正在使用或路径错误');window.location = 'AmeManage.aspx';</script>");
        }



    }


    protected void reader_Click(object sender, EventArgs e)
    {

        sqlpa = "select readerid as 读者编号,ReaderName as 姓名,Password as 密码,Sex as 性别,ClassID as 班级,Telphone as 号码 ,Email as 邮箱,CreateDate as 创建日期,typename as 类型,Account as 账户余额,Remarks as 备注 from Reader_info ,Reader_type where Reader_info.ReaderType=Reader_Type.ReaderType and account<0 and (readerid='" + TextBox1.Text + "' or readerName='" + TextBox1.Text + "'";
        SqlDataSource1.SelectCommand = sqlpa;



    }

    protected void book_Click(object sender, EventArgs e)
    {

        sqlpa = "select Book_info.BookID as 图书编号,Book_info.BookName as 图书条目,Book_info.Writer as 作者,Book_info.BookPlace as 馆藏地点,statusname as 状态 from Book_info,book_status  where Book_info.StatusID =3 and book_status.statusid=book_info.statusid";
        SqlDataSource1.SelectCommand = sqlpa;




    }
}